package com.yxdj.user.api;

import com.yxdj.common.core.constant.SecurityConstants;
import com.yxdj.common.core.constant.ServiceNameConstants;
import com.yxdj.common.core.domain.R;
import com.yxdj.user.api.domain.Engineer;
import com.yxdj.user.api.factory.RemoteEngineerFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteEngineerService", value = ServiceNameConstants.USER_SERVICE, fallbackFactory = RemoteEngineerFallbackFactory.class)
public interface RemoteEngineerService {

    /**
     * app工程师登录
     * @param phone
     * @param source
     * @return
     */
    @PostMapping("/engineer/app/login/{phone}")
    R<Engineer> login(@PathVariable(name = "phone") String phone, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * app工程师注册
     * @param engineer
     * @param source
     * @return
     */
    @PostMapping("/engineer/app/register")
    R<Engineer> register(@RequestBody Engineer engineer, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 根据工程师id获取工程师信息
     * @param id
     * @param source
     * @return
     */
    @GetMapping("/engineer/getEngineerById/{id}")
    R<Engineer> getEngineerById(@PathVariable(name = "id") Long id, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


}
